package service

import (
	"gin/CloudRestaurant/dao"
	"gin/CloudRestaurant/model"
	"gin/CloudRestaurant/tool"
)

type StudentService struct {
}

// 插入一条学生信息
func (ss *StudentService) InSert(stu *model.Student) *model.Student {
	md := dao.StudentDao{tool.DBEngine}
	result := md.InsertOneStudent(stu)
	if result != 0 {
		return stu
	}
	return nil
}

// 根据学号查询一条数据
func (ss *StudentService) FinOneByNgmber(StudentNumber int64) *model.Student  {
	md := dao.StudentDao{tool.DBEngine}
	result := md.FindByNumber(StudentNumber)
	if result != nil{
		return result
	}
	return nil
}